<?php
return array(
	'defaultScope' => array(
		'condition' => "object_type ='ProviderAccount'"
	),

	'attributeLabels' => array(
		'info' => '企业资料',
		'info.category.category_name' => '代理分类',
		'cate_id' => '代理分类',
	),
	
	'rules' => array(
		array('cate_id','safe')
	),

	'relations' => array(
		'info' => array(ActiveRecord::HAS_ONE, 'Provider', 'worker_id'),
		'aRelateds' => array(ActiveRecord::HAS_MANY, 'AgentRelated','provider_id'),
		'web' => array(ActiveRecord::HAS_ONE, 'Website', 'worker_id'),
		'goods' => array(ActiveRecord::HAS_MANY, 'Goods', 'provider_id')
	),

	'cascade' => array(
		'info',
	),

	'behaviors' => array(
		'search' => array(
			'class' => 'application.behaviors.SearchBehavior',
			'searchModel' => 'ProviderSearch'
		),
		'stateHandle' => array(
			'class' => 'ModelState',
			'handleField' => 'status',
			'configName' => 'status.worker.audit',
			'configReader' => Yii::app()->config,
			'initState' => 'ST_NONE',
		),
		'ShopCreator' => array(
			'class' => 'coms.behaviors.worker.ShopCreator',
		),
        'related'=>array(
			'class'=>'coms.behaviors.AgentRelatedBehavior',
			'role'=>AdminUser::ROLE_DEALER,
			'field'=>'dealer_id',
		),
		'hasPhoto' => array(
			'class' => 'coms.behaviors.worker.PhotoBehavior',
			'cateIds' => array(
				2,//酒店
				3//景区
			),
		),
		'createShop' => array(
			'class' => 'coms.behaviors.worker.CreateShopBehavior'
		)
	),

	'_import' => array(
		array('*', 'models.WorkerAccount//*'),
	),
);